//
//  IManager+ModuleOrder.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-7-16.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleOrder.h"
#import "FrameworkRelativeDefines.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "NSString+NSString_Ex_.h"
#import "TravelException.h"
#import "RCFeedbackDataModel.h"
#import "GloableEngineService.h"

@implementation IManager(ModuleOrder)
-(int64_t)requestOrder:(NSString *)Name withShopID:(NSString *)shopID withPhone:(NSString *)phone withExtraInfo:(NSString *)extraInfo withDelegate:(id<IManagerDelegate>)delegate{
    if ([NSString stringIsNullOrEmpty:phone] || [NSString stringIsNullOrEmpty:shopID]) {
        return kInvalidRequestId;
    }
    NSString *bduss = [GloableEngineService sharedInstance].bduss;
    NSMutableDictionary *postValue = [NSMutableDictionary dictionary];
    [postValue setObject:extraInfo forKey:@"content" withDefaultValue:@""];
    [postValue setObject:phone forKey:@"mobile" withDefaultValue:@""];
    [postValue setObject:bduss forKey:@"bduss" withDefaultValue:@""];
    [postValue setObject:Name forKey:@"name" withDefaultValue:@""];
    [postValue setObject:shopID forKey:@"shopid" withDefaultValue:@""];
    // 异步获取数据
    NSString *urlSuffix = kRCOrderUrlPrefix;
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncPostData:url postValues:postValue postDataList:nil userInfo:nil withDataParseClass:[RCFeedbackDataModel class] withDataDelegate:delegate];
}

-(int64_t)requestCommitActivity:(NSString *)activityID withName:(NSString *)name withContent:(NSString *)content withPhone:(NSString *)phone withDelegate:(id<IManagerDelegate>)delegate{
    if ([NSString stringIsNullOrEmpty:phone] || [NSString stringIsNullOrEmpty:activityID]) {
        return kInvalidRequestId;
    }
    
    NSString *bduss = [GloableEngineService sharedInstance].bduss;
    NSMutableDictionary *postValue = [NSMutableDictionary dictionary];
    [postValue setObject:content forKey:@"content" withDefaultValue:@""];
    [postValue setObject:phone forKey:@"phone" withDefaultValue:@""];
    [postValue setObject:bduss forKey:@"bduss" withDefaultValue:@""];
    [postValue setObject:name forKey:@"name" withDefaultValue:@""];
    [postValue setObject:activityID forKey:@"aid" withDefaultValue:@""];
    // 异步获取数据
    NSString *urlSuffix = kRCDiscountActiOrderPrefix;
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncPostData:url postValues:postValue postDataList:nil userInfo:nil withDataParseClass:[RCFeedbackDataModel class] withDataDelegate:delegate];
}

@end
